package org.infoset.xml;

import java.net.*;
import java.io.*;

/**
 * This interface repesents a processor that is able to load document instances
 * from a URI.  If the document cannot be loaded for any reason, this interface
 * must throw an exception.
 * @author <a href="mailto:alex@milowski.com">R. Alexander Milowski</a>
 */
public interface DocumentLoader {

   void setInfoset(Infoset infoset);

   /**
    * Loads a document from a specific location.
    * @param location The location of the document.
    * @return A document instance.
    * @throws java.io.IOException Thrown when the document cannot be loaded.
    */
   Document load(URI location)
      throws java.io.IOException,XMLException;

   Document load(Reader input)
      throws java.io.IOException,XMLException;

   Document load(Reader input,URI baseURI)
      throws java.io.IOException,XMLException;

   void generate(URI location,ItemDestination receiver)
      throws java.io.IOException,XMLException;

   void generate(Reader input,ItemDestination receiver)
      throws java.io.IOException,XMLException;
   
   void generate(Reader input,URI baseURI,ItemDestination receiver)
      throws java.io.IOException,XMLException;
}
